// Copyright 2011 Jim Xochellis
// Licensed under the Apache License, Version 2.0 
// (http://www.apache.org/licenses/LICENSE-2.0)
 
#ifndef __PROF_EVENTS_H__
#define __PROF_EVENTS_H__

#include <cstddef>

namespace generic_profiling
{

enum event_type
{
	no_profiling_event = 0,

	value_pure_creation_event,
	value_copy_creation_event,
	value_move_creation_event,
	value_copy_assignment_event,
	value_move_assignment_event,
	value_simple_comparison_event,
	value_arithmetic_event,
	value_swap_event,

	iterator_pure_creation_event,
	iterator_copy_creation_event,
	iterator_copy_assignment_event,
	iterator_simple_comparison_event,
	iterator_dereference_event,
	iterator_simple_step_event,
	iterator_long_step_event,
	iterator_arithmetic_event,

	profiling_events_count,
};

//---------------------------------------------------------------

class event_handler
{
public:
	virtual ~event_handler() {}
	virtual void handle_event(unsigned the_event) = 0;
};

//---------------------------------------------------------------

void set_event_handler(event_handler *handler);
event_handler *get_event_handler();
void dispatch_event(unsigned event_type);

//--------------------------------------------------------------

void enable_profiling(bool enable);
bool is_profiling_enabled();
size_t get_event_counter(unsigned the_event);
void reset_event_counters();
const char *get_event_name(unsigned the_event);

} //namespace generic_profiling

#endif //__PROF_EVENTS_H__
